

"""
生成器使用
（x for x in range(1,100)）
"""
print(type(range(10)))
#转生成器
g = (x*x for x in range(10))
print(g)

# for a in g:
#     print(a)


def my_function():
    for i in range(10):
        yield i


my = my_function()
print(my)
# for amy in my:
#     print(amy)

print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
# print(next(my))
print("/////////////////////////////////")
my = my_function()
print(my)
# for amy in my:
#     print(amy)

print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
print(next(my))
# print(next(my))
